package edu.hunau.cxb.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 对spingMVC进行配置
 * @author hb
 * @create 2020-04-21 11:47
 */
@Configuration
public class MySpringMvcConfigurer {

    @Bean
    public WebMvcConfigurer webMvcConfigurer(){
        //<mvc:view-controller path="/index.html" view-name="/main/index"/>
        return new WebMvcConfigurer() {
            @Override
            public void addViewControllers(ViewControllerRegistry registry) {
                registry.addViewController("/index.html").setViewName("main/index");
                registry.addViewController("/").setViewName("main/index");
            }


        };

    }
}
